<?php

require_once 'interface.php';

class MysqlDBResult implements DBResult
{

	public function __construct ($db, $mysql_query_resource)
	{
		$this->db = $db;
		$this->rs = $mysql_query_resource;
	} // end of __construct
	public function next ()
	{
		$row = $this->db->lowlevel->fetchAssoc($this->rs);
		if (!is_array($row)) {
			mysql_free_result($this->rs);
			$this->rs = NULL;
			$row = False;
		}
		$this->row = $row;
		return $this->row;
	} // end of function next
	public function current ($field=NULL)
	{
		$res = NULL;
		$row = $this->row;
		if ($row) {
			if (isset($field)) {
				$res = $row[$field]; 
			} else {
				$res = $this->row;
			}
		}
		return $res;
	} // end of function current

}

